package com.yequan.hbb.adapter;

//                            _ooOoo_  
//                           o8888888o  
//                           88" . "88  
//                           (| -_- |)  
//                            O\ = /O  
//                        ____/`---'\____  
//                      .   ' \\| |// `.  
//                       / \\||| : |||// \  
//                     / _||||| -:- |||||- \  
//                       | | \\\ - /// | |  
//                     | \_| ''\---/'' | |  
//                      \ .-\__ `-` ___/-. /  
//                   ___`. .' /--.--\ `. . __  
//                ."" '< `.___\_<|>_/___.' >'"".  
//               | | : `- \`.;`\ _ /`;.`/ - ` : | |  
//                 \ \ `-. \_ __\ /__ _/ .-` / /  
//         ======`-.____`-.___\_____/___.-`____.-'======  
//                            `=---='  
//  
//         .............................................  
//                  佛祖镇楼              BUG辟易  
//          佛曰:  
//                  写字楼里写字间，写字间里程序员；  
//                  程序人员写程序，又拿程序换酒钱。  
//                  酒醒只在网上坐，酒醉还来网下眠；  
//                  酒醉酒醒日复日，网上网下年复年。  
//                  但愿老死电脑间，不愿鞠躬老板前；  
//                  奔驰宝马贵者趣，公交自行程序员。  
//                  别人笑我忒疯癫，我笑自己命太贱；  
//                  不见满街漂亮妹，哪个归得程序员？

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.yequan.hbb.R;
import com.yequan.hbb.entries.RecentBean;

import java.util.List;

/**
 * Created by gwf on 2016/10/14.
 */

public class TRCAdapter extends RecyclerView.Adapter<TRCAdapter.ViewHolder>{
    private Context context;
    private List<RecentBean.DataBean1.ContentBean.DataBean> list;

    public TRCAdapter(Context context, List<RecentBean.DataBean1.ContentBean.DataBean> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_content, parent, false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        RecentBean.DataBean1.ContentBean.DataBean bean = list.get(position);
        holder.name.setText(bean.getClientName());
        holder.littleTitle.setText(bean.getTitle());
        holder.introduce.setText(bean.getIntroduce());
        holder.icon.setImageURI(bean.getClientImage());
        holder.image.setImageURI(bean.getImage().get(0));


    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    public static class ViewHolder extends RecyclerView.ViewHolder{
        private final TextView name;
        private final TextView littleTitle;
        private final TextView introduce;
        private final SimpleDraweeView image;
        private final SimpleDraweeView icon;




        public ViewHolder(View itemView) {
            super(itemView);
            name = ((TextView) itemView.findViewById(R.id.content_name));
            littleTitle = ((TextView) itemView.findViewById(R.id.content_little_title));
            introduce = ((TextView) itemView.findViewById(R.id.introduce));
            image = ((SimpleDraweeView) itemView.findViewById(R.id.image));
            icon = ((SimpleDraweeView) itemView.findViewById(R.id.icon));




        }
    }
}
